home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / snip9503 / ccomcall.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-14  |  670 b   |  38 lines

  1. /*
  2. **  Call undocumented Int 2Eh to invoke COMMAND.COM
  3. **
  4. **  demo by Bob Stout
  5. **
  6. **  NOTES: Dangerous code - will abort batch files in progress and
  7. **         occasionally have other undesirable effects.
  8. **
  9. **         Requires INT2E.ASM
  10. */
  11.  
  12. #include <string.h>
  13. #include <stdlib.h>
  14.  
  15. extern void _Int_2E(char *);
  16.  
  17. void C_Com_Call(char *string)
  18. {
  19.       char *buf;
  20.  
  21.       buf = (char *)malloc(strlen(string) + 3);
  22.       strcat(strcpy(&buf[1], string), "\r");
  23.       buf[0] = (char)strlen(&buf[1]);
  24.       _Int_2E(buf);
  25.       free(buf);
  26. }
  27.  
  28. #ifdef TEST
  29.  
  30. main(int argc, char *argv[])
  31. {
  32.       C_Com_Call(argv[1]);
  33.       return 0;
  34. }
  35.  
  36. #endif
  37.  
  38.